﻿using System;

using Sunyi.Project.WebPoint.Resource;

namespace Sunyi.Project.WebPoint.PlatFormException
{
    public static class ExceptionGenerator
    {
        public static void ThrowArgumentNullException(string argumentName)
        {
            throw new ArgumentNullException(argumentName);
        }

        #region WebPointServiceException

        public static void ThrowInvalidTokenId(Guid tokenId)
        {
            string message = string.Format(PlatformResource.Security_InvalidTokenId, tokenId.ToString());
            throw new WebPointServiceException(message);
        }

        public static void ThrowInvalidAccessCode(Guid tokenId, string accessCode)
        {
            string message = string.Format(PlatformResource.Security_InvalidAccessCode, tokenId.ToString(), accessCode);
            throw new WebPointServiceException(message);
        }

        public static void ThrowAccessDeny(string userName, string accessCode)
        {
            string message = string.Format(PlatformResource.Security_AccessDeny, userName, accessCode);
            throw new WebPointServiceException(message);
        }

        public static void ThrowNoUserToken(string userName)
        {
            string message = string.Format(PlatformResource.Security_NoUserToken, userName);
            throw new WebPointServiceException(message);
        }

        #endregion
    }
}
